<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>添加tag</title>
    <meta content="webkit" name="renderer">
    <meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
    <meta content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0"
          name="viewport">
    <link href="/static/layui/css/layui.css" media="all" rel="stylesheet">
    <link href="/static/admin/style/admin.css" media="all" rel="stylesheet">
    <style>
        .add_order .layui-form-label {
            width: 100px;
        }
        .add_order .layui-input-block {
            margin-left: 130px;
        }
    </style>
</head>
<body>

<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body add_order">
                    <form action="" class="layui-form" lay-filter="component-form-element">
                        <div class="layui-row layui-col-space10 layui-form-item">
                            <div class="layui-col-md12">
                                <label class="layui-form-label">tag名称：</label>
                                <div class="layui-input-block">
                                    <input autocomplete="off" class="layui-input" lay-verify="required" name="tagname"
                                           placeholder="" type="text">
                                </div>
                            </div>
                            <div class="layui-col-md12">
                                <label class="layui-form-label">seo标题：</label>
                                <div class="layui-input-block">
                                    <input autocomplete="off" class="layui-input" name="seo_title"
                                        placeholder="" type="text">
                                </div>
                            </div>
                            <div class="layui-col-md12">
                                <label class="layui-form-label">seo关键字：</label>
                                <div class="layui-input-block">
                                    <input autocomplete="off" class="layui-input" name="seo_keyword"
                                        placeholder="用英文逗号隔开" type="text">
                                </div>
                            </div>
                            <div class="layui-col-md12">
                                <div class="layui-form-item layui-form-text">
                                    <label class="layui-form-label">seo描述：</label>
                                    <div class="layui-input-block">
                                        <textarea class="layui-textarea" name="seo_description"
                                            placeholder=""></textarea>
                                    </div>
                                </div>
                            </div>
                            
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <button class="layui-btn" lay-filter="component-form-element" lay-submit>立即提交</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>


<script src="/static/layui/layui.js"></script>
<script>
    layui.config({
        base: '/static/admin/' //静态资源所在路径
    }).use(['form'], function () {
        var $ = layui.$
            , admin = layui.admin
            , element = layui.element
            , form = layui.form;


        form.on('submit(component-form-element)', function (data) {

            $.post("{:url('tag/add')}", data.field, function (res) {

                if (0 == res.code) {

                    layer.msg(res.msg);
                    setTimeout(function () {

                        var index = parent.layer.getFrameIndex(window.name);
                        parent.layer.close(index);
                        window.parent.renderTable();
                    }, 200);
                } else {

                    layer.alert(res.msg, {
                        'title': '添加错误',
                        'icon': 2
                    });
                }
            }, 'json');
            return false;
        });
    });
</script>
</body>
</html>